<?php
/**
 * common model file Created by PhpStorm.
 * User: wumengmeng
 * Date: 2019/12/04
 * Time: 15:46
 */

namespace HiCommon\Model;

class MaintainConfig extends Base
{

    protected $table = 'maintain_config';

    protected $guarded = [];

    //public $timestamps = false;

    /**
     * 应该被调整为日期的属性
     *
     * @var array
     */
    protected $dates = [
    ];

    //自己关联自己
    public function son()
    {
        return $this->hasMany(MaintainConfig::class, 'pid', 'id')
            ->select('id', 'pid', 'name','explain');
    }

    /**
     * 扩展信息
     *
     * @return array
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function getExtendAttribute()
    {
        $s_created_at = $this->created_at;
        $arr_data = [
            'created_at' => ymd_friendly_date($s_created_at),
        ];

        return $arr_data;
    }


}